﻿Imports MICROFORMA.BEL
Imports MICROFORMA.DAL
Imports System.Data
Imports System.Transactions

Public Class ArbolBL
    Dim _arboles As ArbolDA

    Public Function AgregarArbol(ByVal _arbol As Arbol, ByVal _dataIndex As DataIndex) As Integer
        _arboles = New ArbolDA
        Return _arboles.Agregar(_arbol, _dataIndex)
    End Function

    Public Function ObtenerRegistros() As List(Of Arbol)
        _arboles = New ArbolDA
        Return _arboles.ObtenerDatos
    End Function

    Public Function ObtenerHijosDeArbol(ByVal _idDocumento As Int16) As List(Of Arbol)
        _arboles = New ArbolDA
        Return _arboles.ObtenerHijos(_idDocumento)
    End Function

    Public Function AgregarNodo(ByVal _intNodoPadre As Int16, ByVal _idTipo As String, ByVal _esReeScan As Boolean, ByVal _intVolumen As Int16, ByVal _estado As String, ByVal _enBDA As Boolean, ByVal _esEncryp As Boolean, ByVal _strNombreCarpeta As String, ByVal _strTituloCarpeta As String) As Integer

        Dim localDataEntidad As New Arbol

        With localDataEntidad

            .IdPadre = _intNodoPadre
            .IdTipo = _idTipo
            .EsReescaneado = _esReeScan
            .IdVolumen = _intVolumen
            .Estado = _estado
            .EnBaseDatos = _enBDA
            .EsEncriptado = _esEncryp
            .SubTitutlo = _strTituloCarpeta
            .FechaCreacion = DateTime.Now

            '.Estado = CType(dvwABC.FindControl("ddlEstado"), DropDownList).SelectedValue
        End With

        Dim _dataIndexBL As New DataIndexBL
        Dim _DataIndexBEL As New DataIndex

        _DataIndexBEL.IdTitulo = _strNombreCarpeta

        Dim idDocumento As Int16 = AgregarArbol(localDataEntidad, _DataIndexBEL)

        '_DataIndexBEL.IdDocumento = idDocumento

        'idDocumento = _dataIndexBL.AgregarDataIndex(_DataIndexBEL)

        Return idDocumento

    End Function
End Class
